import { Layout } from 'antd'
import { NavLink, getLocale, setLocale, useIntl } from 'umi'
import { Menu, Dropdown, Popover, Badge, Select } from 'antd';
import { BellOutlined ,DownOutlined} from '@ant-design/icons'
import './studentsLayout.less'
import { useEffect, useState } from 'react';
import { getInfo1 } from '@/services';
import { Iusers } from '@/utils/interface';
import {removeCookie} from '@/utils/auth'

declare interface Window {
    _hmt: any
}
const { Header, Footer, Content } = Layout
const interviewList = <Menu>
    <Menu.Item>
        <NavLink to='/students/interviewManage'>面试记录</NavLink>
    </Menu.Item>
    <Menu.Item>
        <NavLink to='/students/myInterviewManage'>我的面试记录</NavLink>
    </Menu.Item>
    <Menu.Item>
        <NavLink to='/students/rankList'>面试排行榜</NavLink>
    </Menu.Item>
</Menu>
const questionMenu = <Menu>
    <Menu.Item>
        <NavLink to='/students/projectAnswer'>问答列表</NavLink>
    </Menu.Item>
    <Menu.Item>
        <NavLink to='/students/myQuestionAnswer'>我的问答</NavLink>
    </Menu.Item>
</Menu>
const studentPersonCenter = <Menu>
<Menu.Item>
  <NavLink to="/students/studentPersonCenter">个人中心</NavLink>
</Menu.Item>
<Menu.Item>
  <NavLink to="/login" onClick={()=>removeCookie()}>退出</NavLink>
</Menu.Item>
</Menu>
const content = (
    <div>
        <p>Content</p>
        <p>Content</p>
    </div>
);

const StudentLayout: React.FC = (props) => {
    const intl = useIntl();
    const [ users, setusers ] = useState<Iusers>({} as Iusers)
  useEffect(() => {
    getInfo1().then(res=>{
      if(res.code === 200){
        console.log(res.code)
          setusers({...res.user})
      }
    })
  }, [])
    return <Layout>
        <Header className='header1'>
            <img src="http://111.203.59.61:8060/static/img/w_bw.172a76e5.png" alt="" />
            <div className='navList'>
                <NavLink to='/students/highPost'>{intl.formatMessage({
                    id: 'header.station',
                })}</NavLink>
                <NavLink to='/students/projectKu'>{intl.formatMessage({
                    id: 'header.project'
                })}</NavLink>
                <NavLink to='/students/myProject'>{intl.formatHTMLMessage({
                  id:'header.practical'
                })}
                </NavLink>
                <Dropdown overlay={interviewList}><span>{intl.formatMessage({id: 'header.interview',})}<DownOutlined /></span></Dropdown>
                <Dropdown overlay={questionMenu}><span>{intl.formatMessage({id: 'header.answer',})}<DownOutlined /></span></Dropdown>
                <Select value={getLocale()} onChange={value=>setLocale(value, false)} style={{width:70,marginTop:20}}>
                    <Select.Option value="en-US">English</Select.Option>
                    <Select.Option value="zh-CN">中文</Select.Option>
                </Select>
            </div>
            <span>
      <Dropdown overlay={studentPersonCenter}><img id='img' src={'http://111.203.59.61:8060'+users.avatar} alt=""/></Dropdown>
        <span className='span'>{users.nickName}</span>
      </span>
        </Header>
        <Content>{props.children}</Content>
        <Footer>
            <div className="bw_bottom">
                <div className="b_b_detail">
                    <div className="b_b_left">
                        <div className="bw_img">
                            <img src="http://111.203.59.61:8060/static/img/bottom_logo.c8aa9859.png" alt="" />
                        </div>
                        <div className="b_w_tel">400-008-0987</div></div>
                    <div className="b_b_middle">
                        <div className="middle_one middle">
                            <div className="middle_title">走进八维</div>
                            <div className="href_a">
                                <a href="http://bwie.cn/bwie/about.html">集团概况</a>
                            </div>
                            <div className="href_a">
                                <a href="http://bwie.cn/bwie/news/index.html">八维动态</a>
                            </div>
                            <div className="href_a">
                                <a href="http://bwie.cn/bwie/lead.html">领导关怀</a>
                            </div>
                            <div className="href_a">
                                <a href="http://bwie.cn/bwie/honour.html">企业荣誉</a>
                            </div>
                        </div>
                        <div className="middle_two middle">
                            <div className="middle_title">八维文化</div>
                            <div className="href_a">
                                <a href="http://bwie.cn/bwie/culture.html">八维理念</a>
                            </div>
                            <div className="href_a">
                                <a href="http://bwie.cn/bwie/spirit.html">八维精神</a>
                            </div>
                            <div className="href_a">
                                <a href="http://bwie.cn/bwie/dak.html">文化驿站</a>
                            </div></div><div className="middle_three middle">
                            <div className="middle_title">社会责任</div>
                            <div className="href_a">
                                <a href="http://bwie.cn/bwie/duty/public.html">社会公益</a>
                            </div>
                            <div className="href_a">
                                <a href="http://bwie.cn/bwie/duty/great.html">大善之举</a>
                            </div>
                        </div>
                        <div className="middle_four middle">
                            <div className="middle_title">联系我们</div>
                            <div className="href_a">
                                <a href="http://bwie.cn/bwie/partners.html">业务合作</a>
                            </div>
                            <div className="href_a">
                                <a href="http://bwie.cn/bwie/sign_up.html">咨询报名</a>
                            </div>
                            <div className="href_a">
                                <a href="http://bwie.cn/bwie/concact.html">联系方式</a>
                            </div>
                        </div>
                    </div>
                    <div className="b_b_right">
                        <img src="http://111.203.59.61:8060/static/img/wechat.e60a83ec.png" alt="" />
                        <div className="wechat_text">八维微信公众号</div>
                    </div>
                </div>
                <div className="b_b_sign">京公网安备 11010802031438号 © Copyright 2020. 八维教育版权所有 | 京ICP备12008262号-12</div>
            </div>
        </Footer>
    </Layout>
}

export default StudentLayout